package 第二章;

import java.util.Arrays;

public class 第四题 {
    public static void main(String[] args) {
        int[] nums = new int[6];
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == 0) {
                boolean flag = false;
                int random = (int) (Math.random() * 33 + 1);
                for (int j = 0; j < i; j++) {
                    if (random == nums[j]) {
                        i--;
                        flag = true;
                        break;
                    }
                } // end 内循环
                if (!flag) {
                    nums[i] = random;
                }

            }
        } // end 外循环
        Arrays.sort(nums);
        int random = (int) (Math.random() * 16 + 1);
        System.out.println("双色球预测号:");
        for (int i = 0; i < nums.length; i++) {
            if (i != nums.length - 1) {
                System.out.print(nums[i] + ",");
            } else {
                System.out.print(nums[i]);
            }
        }
        System.out.println(" + " + random);
        System.out.println("预祝你早日中大奖！");
    }

}
